package com.dbappsecurity.jsbridge.receivers;

/**
 * Created by arirus on 2017/7/24.
 */

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.dbappsecurity.jsbridge.webview.CompletionHandler;

public class HomePressedReceiver extends BroadcastReceiver {

    private CompletionHandler mHandler;

    public HomePressedReceiver(CompletionHandler handler) {
        mHandler = handler;
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction(); //目前仅是监听home没监听菜单
        if (action.equals(Intent.ACTION_CLOSE_SYSTEM_DIALOGS) && intent.getStringExtra("reason").equals("homekey")){
            mHandler.setProgressData("点击了Home键");
        }
    }
}